package java101;

import junit.framework.TestCase;

public class GeoTestLat extends TestCase {

	public void testLatitude() {
		GeoAngle equator = new Latitude(0.);
		assertEquals(0., equator.getDeg());
		GeoAngle northPole = new Latitude(90.);
		assertEquals(90., northPole.getDeg());
	}
	
	public void testNewLatDMS() {
		GeoAngle lat = new Latitude(60,0,3.6);
		assertEquals(60.001, lat.getDeg(), 1e-12); //third field = margin of error to account for end of decimal 'double' errors
	}
	
//	public void bogus(HasMaxRange lat) {
//		lat.getMaxRange();
//		lat.getDeg();
//		lat.getLat();
//	}
	
	public void testNewLatDMSOUtofRangeMax() {
		try {
			GeoAngle outofRangeMax = new Latitude(90,0,1);
			fail ("Should have thrown exception");
		} catch (IllegalArgumentException e) {
			// passed (because it failed)
		}
	}
	
	public void testOutOfRangeMax() {
		try {
			GeoAngle outOfRangeMax = new Latitude(90.1);
			fail("Should have thrown exception");
		} catch (IllegalArgumentException e) {
			// passed (because it failed)
		}
		
	}
	public void testOutOfRangeMin() {
		try {
			GeoAngle outOfRangeMin = new Latitude(-90.1);
			fail("Should have thrown exception");
		} catch (IllegalArgumentException e) {
			// passed (because it failed)
		}
	}
	}
	

